﻿<UserControl x:Class="Gallery.Converters.ConvertersView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:apexControls="clr-namespace:Apex.Controls;assembly=Apex"
             xmlns:Converters="clr-namespace:Gallery.Converters"
             xmlns:apexConverters="clr-namespace:Apex.Converters;assembly=Apex" mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800">
    
    <UserControl.Resources>
        <Style TargetType="{x:Type TextBlock}" x:Key="Heading">
            <Setter Property="FontSize" Value="16" />
            <Setter Property="FontWeight" Value="SemiBold" />
        </Style>

        <apexConverters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

    </UserControl.Resources>

    <Grid Style="{StaticResource GalleryItemStyle}">

    <apexControls:PaddedGrid Rows="Auto,Auto,*,Auto" Padding="4">

        <!-- Title section. -->
        <TextBlock Grid.Row="0" Style="{StaticResource Heading1}">CONVERTERS</TextBlock>
        <TextBlock Grid.Row="1" Style="{StaticResource Subtitle}">
            A number of Converters are provided by the Apex framework to deal with typical value conversion tasks.
        </TextBlock>

        <Grid Row="2" Margin="16" MaxWidth="600" MaxHeight="800">
            <ScrollViewer>
                <StackPanel Orientation="Vertical">

                    <!-- Boolean to visibilty. -->
                    <apexControls:PaddedGrid Rows="Auto,Auto,Auto" Padding="4" Margin="20">
                        <TextBlock Grid.Row="0" Style="{StaticResource Heading}" Text="BooleanToVisibilityConverter" />
                        <TextBlock Grid.Row="1" TextWrapping="Wrap">
                    The BooleanToVisibilityConverter converts a bool value into a System.Windows.Visibility value. A value of false converts to Visiblity.Collapsed,
                    unless the converter is inverted by providing 'Invert' as a parameter.
                        </TextBlock>
                        <apexControls:PaddedGrid Grid.Row="2" Columns="Auto,Auto" Padding="4">
                            <CheckBox Grid.Column="0" Content="Boolean Value" IsChecked="{Binding ExampleBool1}" />
                            <TextBlock Grid.Column="1" Text="This value is shown only when bool is true."
                               Visibility="{Binding ExampleBool1, Converter={StaticResource BooleanToVisibilityConverter}}" />
                        </apexControls:PaddedGrid>
                    </apexControls:PaddedGrid>

                </StackPanel>
            </ScrollViewer>
        </Grid>
    </apexControls:PaddedGrid>

    
    </Grid>
</UserControl>
